<template>
    <div class="main_div">
        <div class="text_div">文件上传</div>
        <el-upload class="upload-demo" drag :auto-upload="false" @change="onChange" limit="2">
            <el-icon class="el-icon--upload"><upload-filled /></el-icon>
            <div class="el-upload__text">
                拖拽或 <em>点击上传</em>
            </div>
            <div class="el-upload__text">
                只选一份文件 <em>默认与数据库数据比对</em>
            </div>
        </el-upload>
        <el-radio-group class="radio" v-model="radio1">
            <el-radio value="整段" size="large">整段</el-radio>
            <el-radio value="分段" size="large">分段</el-radio>
            <el-button type="success" @click="upload">确认上传</el-button>
        </el-radio-group>
    </div>
</template>

<script>
export default {
    name: 'upload',
    data() {
        return {
            //比对文件
            C_file: null,
            //被比对文件
            DAC_file: null,
            //选择项
            radio1: "整段",
            //上传文件
            fileData: null,
        }
    },
    methods: {
        // 接收上传文件
        onChange(fileList) {
            if (this.C_file == null) {
                this.C_file = fileList.raw;
                console.log(fileList);
            } else {
                this.DAC_file = fileList.raw;
                console.log(this.DAC_file);
            }
        },
        // 提交文件
        submit() {
            console.log(this.C_file);
        },
    },
}
</script>

<style>
.main_div {
    width: 100%;
}

.text_div {
    margin-bottom: 15px;
}

.radio {
    margin-top: 15px;
}
</style>